<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/js/jquery.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");

Yii::app()->clientScript->registerCss("CSS1","
    .cont_box img{
        height: 200px;
    }
    .wrap{
        width:100%;

    }
    .wrap .left{
        width:30%;
        height:60%;
        float: left;
        padding: 20px;
    }
    .wrap .left .icon-user{
        font-size:80px;
    }
    .wrap .right {
        float: right;
        height: 60%;
        padding-right: 25px;
        padding-top: 65px;
        width: 69%;
    }
    .wrap .right p{
        margin-bottom:10px;
    }
   #loadings {
        left: 50%;
        position: absolute;
        top: 50%;
    }
@-webkit-keyframes bounce {
            0%, 20%, 53%, 80%, 100% {
                -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                -webkit-transform: translate3d(0,0,0);
                transform: translate3d(0,0,0);
            }

            40%, 43% {
                -webkit-transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                -webkit-transform: translate3d(0, -30px, 0);
                transform: translate3d(0, -30px, 0);
            }

            70% {
                -webkit-transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                -webkit-transform: translate3d(0, -15px, 0);
                transform: translate3d(0, -15px, 0);
            }

            90% {
                -webkit-transform: translate3d(0,-4px,0);
                transform: translate3d(0,-4px,0);
            }
        }

        @keyframes bounce {
            0%, 20%, 53%, 80%, 100% {
                -webkit-transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
                -webkit-transform: translate3d(0,0,0);
                transform: translate3d(0,0,0);
            }

            40%, 43% {
                -webkit-transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                -webkit-transform: translate3d(0, -30px, 0);
                transform: translate3d(0, -30px, 0);
            }

            70% {
                -webkit-transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                transition-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
                -webkit-transform: translate3d(0, -15px, 0);
                transform: translate3d(0, -15px, 0);
            }

            90% {
                -webkit-transform: translate3d(0,-4px,0);
                transform: translate3d(0,-4px,0);
            }
        }
        .bounce {
            -webkit-animation: bounce 1.2s ease-in infinite;
            -o-animation: bounce 1.2s ease-in infinite;
            animation: bounce 1.2s ease-in infinite;
        }
");


?>
<style type="text/css">
    .main-box {
        background: #308BC4 url("<?php echo $this->staticsPath."/img/login.jpg" ?>") no-repeat scroll 0 0 / 100% auto;
        height: 100%;
        left: 0;
        margin: 0 auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: -1;
    }
    .morcon {
        height: 100px;
        margin: 80px 20px 20px;
        position: relative;
        text-align: center;
    }

    .morcon .reg {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        font-size: 20px;
        left: 4%;
        position: absolute;
        top: 0;
    }
    .morcon .login {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        display: block;
        font-size: 20px;
        left: 48%;
        position: absolute;
        top: 30%;
    }
    .haitun{
        height: 170px;
        left: 10px;
        position: relative;
        top: 20px;
        width: 130px;
        background: url("<?php echo $this->staticsPath."/img/haitun.png" ?>") no-repeat scroll 0 0 / 100% auto;
    }
</style>
<?php if($type==1){ ?>
<div  class="loading" style="display: block">
    <div id="loading">
        <div id="loadings">
            <i class="fa fa-cog fa-spin"></i>
        </div>
    </div>
</div>
<?php } ?>
<div class="data" <?php if($type==1){ ?>style="display: none"<?php } ?>>
    <div class="main-box"></div>
    <div class="haitun bounce"></div>
    <section class="wrap">
        <div class="morcon">
            <a class="reg" href="<?php echo $this->createUrl('register',array('openid'=>$openid)) ?>">注册</a>
            <a class="login" href="<?php echo $this->createUrl('login',array('openid'=>$openid)) ?>">登录</a>
        </div>
    </section>
</div>
<?php if($type==1){ ?>
<script type="text/javascript">
    $(function(){
        var storage = window.localStorage;
        var stroeUser = storage["stroeUser"];
        $.ajax({
            type: "POST",
            url: '<?php echo Yii::app()->createUrl('index/ajaxCheckUser'); ?>',
            data: {
                type:<?php echo $app_info->is_type ?>,
                stroeUser:stroeUser
            },
            dataType: "json",
            success: function (data) {
                if (data) {
                    if(data.status==0){
                        $(".loading").hide();
                        $(".data").show();
                    }else{
                        if(data.role==1){
                            window.location.href='<?php echo Yii::app()->createUrl('index/list',array('openid'=>$openid)); ?>';
                        }else{
                            window.location.href='<?php echo Yii::app()->createUrl('index/list1',array('openid'=>$openid)); ?>';
                        }
                    }
                }else{
                    window.location.href='<?php echo Yii::app()->createUrl('index/list',array('openid'=>$openid)); ?>';
                }
            }
        });
    });
</script>
<?php } ?>